package com.bupt.liutong.admin.sch.dao;

import java.util.List;

import com.bupt.liutong.admin.core.base.Ibatis;
import com.bupt.liutong.admin.sch.dto.News;

public class NewsDao {

	private Ibatis ibatis;

	@SuppressWarnings("unchecked")
	public List<News> getNewsesByPage(News news) {
		return (List<News>) ibatis.queryForPage("sch_news.getNewses", news);
	}

	public News getNewsById(int id) {
		return (News) ibatis.queryForObject("sch_news.getNewsById", id);
	}

	public void insertNews(News news) {
		ibatis.insert("sch_news.insertNews", news);
	}

	public void updateNews(News news) {
		ibatis.update("sch_news.updateNews", news);
	}
	
	public void updateNewsState(News news){
		ibatis.update("sch_news.updateNewsState", news);
	}

	public void deleteNews(int id) {
		ibatis.delete("sch_news.deleteNews", id);
	}

	public void setIbatis(Ibatis ibatis) {
		this.ibatis = ibatis;
	}
}
